package ipms.necfgsyn;

import ipms.appbase.ClsPublic;

import java.rmi.Naming;
import java.util.Properties;

public class CfgSynClient {

	private static String sRmiAddr="127.0.0.1";
	private static int iRmiPort=21099;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Properties prop;
		try {
			prop = ClsPublic.getPropXml("appini.xml");
			sRmiAddr = prop.getProperty("RmiAddr").trim();
			String s = prop.getProperty("RmiPort").trim();
			iRmiPort = Integer.parseInt(s);
			
			ICfgSynRmi cfgsyn = (ICfgSynRmi)Naming.lookup("//"+sRmiAddr+":"+String.valueOf(iRmiPort)+"/CfgSyn");
			
			if(args.length == 1) {
				int iNeId = Integer.parseInt(args[0]);
				System.out.println("Starting synchronization for NeId = " + args[0]);
				cfgsyn.sync(iNeId);
			} else {
				System.out.println("Starting synchronization for All Nes");
				cfgsyn.sync();
			}
			
			System.out.println("Finished");
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		

	}

}
